import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"
import Overview from "@/views/Overview.vue"
import FormExample from "@/views/FormExample.vue"
import RestFilterExample from "@/views/RestFilterExample.vue"
import RestTableExample from "@/views/RestTableExample.vue"
import TabsExample from "@/views/TabsExample.vue"
import ListViewExample from "@/views/ListViewExample.vue"
import ButtonExample from "@/views/ButtonExample.vue"
import ClipboardExample from "@/views/ClipboardExample.vue"

export const routes: RouteRecordRaw[] = [
  { name: "Root", path: "/", redirect: "/overview" },
  {
    name: "Overview",
    path: "/overview",
    meta: { title: "概览" },
    component: Overview,
  },
  {
    name: "FormExample",
    path: "/form",
    meta: { title: "表单" },
    component: FormExample,
  },
  {
    name: "RestFilterExample",
    path: "/rest-filter",
    meta: { title: "查询过滤" },
    component: RestFilterExample,
  },
  {
    name: "RestTableExample",
    path: "/rest-table",
    meta: { title: "查询表格" },
    component: RestTableExample,
  },
  {
    name: "ListViewExample",
    path: "/list-view",
    meta: { title: "列表视图" },
    component: ListViewExample,
  },
  {
    name: "TabsExample",
    path: "/tabs",
    meta: { title: "标签页" },
    component: TabsExample,
  },
  {
    name: "ButtonExample",
    path: "/button",
    meta: { title: "按钮" },
    component: ButtonExample,
  },
  {
    name: "ClipboardExample",
    path: "/clipboard",
    meta: { title: "粘贴板" },
    component: ClipboardExample,
  },
  {
    name: "ReViewTabsExample",
    path: "/tabs",
    component: ()=>import('@/views/ReViewTabsExample.vue'),
    children: [
      {
        name: "TabRestFilterExample",
        path: "/tabs/rest-filter",
        meta: { title: "查询过滤" },
        component: ()=>import('@/views/RestFilterExample.vue'),
      },
      {
        name: "TabRestTableExample",
        path: "/tabs/rest-table",
        meta: { title: "查询表格" },
        component: ()=>import('@/views/RestTableExample.vue'),
      },
      {
        name: "TabButtonExample",
        path: "/tabs/button/:name",
        meta: { title: "按钮", haveMainTitle: true },
        component: ()=>import('@/views/ButtonExample.vue'),
      },
    ],
  },
]

export const router = createRouter({
  routes,
  history: createWebHashHistory(),
})

export default router
